package com.xncoding.Socket.integration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
import org.springframework.integration.ip.tcp.connection.TcpNetServerConnectionFactory;

@Configuration
@EnableIntegration
public class TcpServerConfig {

    @Bean
    public AbstractServerConnectionFactory serverConnectionFactory() {
        TcpNetServerConnectionFactory factory = new TcpNetServerConnectionFactory(8080);
        return factory;
    }

   /* @Bean
    public ServiceActivator serviceActivator(AbstractServerConnectionFactory connectionFactory) {
        return message -> System.out.println("Received message: " + ((String) message.getPayload()));
    }*/
}